package cn.itcast.web.controller.stat;

import cn.itcast.service.stat.StatService;
import cn.itcast.web.controller.BaseController;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/stat")
public class StatController extends BaseController{

    @Reference
    private StatService statService;

    //跳转页面
    @RequestMapping("/toCharts")
    public String toCharts(String chartsType){   //chartsType = factory|online|sell
        return "stat/stat-"+chartsType;
    }

    //获取厂家销量统计数据
    @RequestMapping("/getFactoryData")
    @ResponseBody
    public List getFactoryData(){
        return statService.getFactoryData(getLoginCompanyId()); //根据企业id查询
    }
    //获取产品销量排行榜
    @RequestMapping("/getSellData")
    @ResponseBody
    public List getSellData(){
        return  statService.getSellData(getLoginCompanyId());  //根据企业id查询
    }

    //获取系统访问压力数据
    @RequestMapping("/getOnLineData")
    @ResponseBody
    public List getOnLineData(){
        return statService.getOnLineData(getLoginCompanyId()); //根据企业id查询
    }


}
